<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	template="/web/templates/template-dialogo-fw-arq.xhtml">

	<ui:define name="dialog">
        <p:dialog header="Dashboard: Demonstrações Consolidadas do Resultado do(a) #{mBeanViewerDemoConsol.entidadeAExibir}" 
            widgetVar="widgetViewerSubcontasDemoConsol" 
            id="painelDialogViewerSubcontasDemoConsol" width="1024" 
            height="600" modal="true" resizable="false" dynamic="true" 
            position="center,top">
            
            <p:ajax event="close" listener="#{mBeanViewerDemoConsol.cancelarDetalharSubcontas}" />
            
            <p:outputPanel id="outputPanelViewerSubcontasDemoConsol"
                rendered="true" autoUpdate="true">

			    <p:dataGrid
			        id="dataGridEvolucaoSubcontas" 
			        style="margin:0px auto;width:100%;height:100%;font-weight:bold;"
			        var="beanViewerSubconta" value="#{mBeanViewerDemoConsol.beansViewerSubcontas}"
			        columns="1"
			        emptyMessage="Não há subcontas recuperadas para esta conta.">
			        <p:panelGrid style="margin:0px auto;width:100%;height:100%;font-weight:bold;">
				        <p:row>
				            <p:column style="width:80%;word-wrap:break-word;white-space:normal;"
				                colspan="#{empty beanViewerSubconta.extendedStats ? 2 : 1}">
				                <p:chart type="#{beanViewerSubconta.chartType}" 
				                    widgetVar="widgetVarSubcontaChart_#{beanViewerSubconta.label}"
				                    model="#{beanViewerSubconta.chartModel}"
				                    style="height:480px;">
				                </p:chart>
				                <p:commandButton action="#{mBeanViewerDemoConsol.detalharSubSubcontas(beanViewerSubconta)}"
				                    process="@this"
				                    onclick="PF('widgetViewerSubSubcontasDemoConsol').show()"
				                    icon="ui-icon-search"
				                    title="Detalhar"
				                    rendered="#{!beanViewerSubconta.consolidado}">
				                    <f:setPropertyActionListener 
				                        target="#{mBeanViewerDemoConsol.telaEmExibicaoSubSubcontas}" 
				                        value="#{true}" />
				                </p:commandButton>
					        </p:column>
				            <p:column style="width:20%;word-wrap:break-word;white-space:normal;"
				                rendered="#{!empty beanViewerSubconta.extendedStats}">
				                <p>Min: <h:outputText value="#{beanViewerSubconta.extendedStats.min}"><f:convertNumber locale="pt_BR" /></h:outputText></p>
				                <p>Max: <h:outputText value="#{beanViewerSubconta.extendedStats.max}"><f:convertNumber locale="pt_BR" /></h:outputText></p>
				                <p>Média: <h:outputText value="#{beanViewerSubconta.extendedStats.avg}"><f:convertNumber locale="pt_BR" /></h:outputText></p>
				                <p>Desvio padrão: <h:outputText value="#{beanViewerSubconta.extendedStats.stdDeviation}"><f:convertNumber locale="pt_BR" /></h:outputText></p> 
				            </p:column>
				        </p:row>
				        <p:row rendered="#{!empty beanViewerSubconta.mensagem}">
				            <p:column colspan="2">
					            <div class="ui-messages-warn ui-corner-all" style="margin:0px auto;width:95%;font-weight:bold;">
					                <span class="ui-messages-warn-icon"></span>
					                <span class="ui-messages-warn-summary">
					                    #{beanViewerSubconta.mensagem.mensagem}
					                </span>
					            </div>
				            </p:column>
				        </p:row>
			        </p:panelGrid>
			    </p:dataGrid>
		    
		    </p:outputPanel>
         </p:dialog>
	</ui:define>
</ui:composition>
